using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Vod_Log - 视频播放日志 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IVodLog<T> :ModelBase<VodLog> where T : VodLog, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.LogId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return LogId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.LogId=dy.LogId;
           this.UserId=dy.UserId;
           this.IsOk=dy.IsOk;
           this.SeeTime=dy.SeeTime;
           this.VodTime=dy.VodTime;
           this.OverTime=dy.OverTime;
           this.Version=dy.Version;
        } 

        #region 定义属性

     
         /// <summary>
        /// 看片记录
        /// </summary>
        private String _LogId = "";
      
        /// <summary>
        /// 看片记录
        /// </summary>
        public String LogId
        {
            get 
            {
              return   (this._LogId); 
            }

            set 
            {
                    _LogId= value;  
            }
        }
       
     
         /// <summary>
        /// 用户ID
        /// </summary>
        private String _UserId = "";
      
        /// <summary>
        /// 用户ID
        /// </summary>
        public String UserId
        {
            get 
            {
              return   (this._UserId); 
            }

            set 
            {
                    _UserId= value;  
            }
        }
       
     
         /// <summary>
        /// 是否完成
        /// </summary>
        private int _IsOk =-1;
      
        /// <summary>
        /// 是否完成
        /// </summary>
        public yq.Enums.BooleanType IsOk
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsOk; 
            }

            set 
            {
                    _IsOk= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 看片时长
        /// </summary>
        private DateTime _SeeTime =DateTime.MinValue;
      
        /// <summary>
        /// 看片时长
        /// </summary>
        public DateTime SeeTime
        {
            get 
            {
              return   (this._SeeTime); 
            }

            set 
            {
                    _SeeTime= value;  
            }
        }
       
     
         /// <summary>
        /// 本片时长
        /// </summary>
        private DateTime _VodTime =DateTime.MinValue;
      
        /// <summary>
        /// 本片时长
        /// </summary>
        public DateTime VodTime
        {
            get 
            {
              return   (this._VodTime); 
            }

            set 
            {
                    _VodTime= value;  
            }
        }
       
     
         /// <summary>
        /// 最后一次浏览时间
        /// </summary>
        private DateTime _OverTime =DateTime.MinValue;
      
        /// <summary>
        /// 最后一次浏览时间
        /// </summary>
        public DateTime OverTime
        {
            get 
            {
              return   (this._OverTime); 
            }

            set 
            {
                    _OverTime= value;  
            }
        }
       
     
        
       

      #endregion 定义属性 

          protected internal override void SetValue(VodLog info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["LogId"]!= DBNull.Value)
                  {
                  info.LogId=row["LogId"].ToString();
                 }
                 
                  
                  if(row["UserId"]!= DBNull.Value)
                  {
                  info.UserId=row["UserId"].ToString();
                 }
                 
                  
                  if(row["IsOk"]!= DBNull.Value)
                  {
                  info.IsOk= (yq.Enums.BooleanType)(row["IsOk"]) ;
                 }
                 
                  
                  if(row["SeeTime"]!= DBNull.Value)
                  {
                  info.SeeTime=Convert.ToDateTime(row["SeeTime"]);
                 }
                 
                  
                  if(row["VodTime"]!= DBNull.Value)
                  {
                  info.VodTime=Convert.ToDateTime(row["VodTime"]);
                 }
                 
                  
                  if(row["OverTime"]!= DBNull.Value)
                  {
                  info.OverTime=Convert.ToDateTime(row["OverTime"]);
                 }
                 
                  
                  if(row["Version"]!= DBNull.Value)
                  {
                  info.Version=row["Version"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, VodLog info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@LogId", DbType.String,ParameterTool.GetObj( info._LogId )); 
            
             
                cn.AddInParameter(comm, "@UserId", DbType.String,ParameterTool.GetObj( info._UserId )); 
            
             
                cn.AddInParameter(comm, "@IsOk", DbType.Int32,ParameterTool.GetObj( info._IsOk )); 
            
             
                cn.AddInParameter(comm, "@SeeTime", DbType.DateTime,ParameterTool.GetObj( info._SeeTime )); 
            
             
                cn.AddInParameter(comm, "@VodTime", DbType.DateTime,ParameterTool.GetObj( info._VodTime )); 
            
             
                cn.AddInParameter(comm, "@OverTime", DbType.DateTime,ParameterTool.GetObj( info._OverTime )); 
            
                
                cn.AddInParameter(comm,"@Version", DbType.String, Guid.NewGuid().ToString());
              

                cn.AddInParameter(comm,"@_versionOdl", DbType.String, info._Version); 
                 
        } 

    } 
} 